(abbreviate-file-name): Make abbreviated-home-dir
authorRichard M. Stallman <rms@gnu.org>
Thu, 10 Jun 1993 20:44:12 +0000 (20:44 +0000)
committerRichard M. Stallman <rms@gnu.org>
Thu, 10 Jun 1993 20:44:12 +0000 (20:44 +0000)
from `~/', not from just `~'.

lisp/files.el

index b7cbb96db2b082eb9865baf7730d232e88ae9ef1..37ad1c980bc45c543206696b875161e83ed4eb98 100644 (file)
@@ -509,10 +509,12 @@ Type \\[describe-variable] directory-abbrev-alist RET for more information."
     ;; Compute and save the abbreviated homedir name.
     ;; We defer computing this until the first time it's needed, to
     ;; give time for directory-abbrev-alist to be set properly.
+    ;; We include a slash at the end, to avoid spurious matches
+    ;; such as `/usr/foobar' when the home dir is `/usr/foo'.
     (or abbreviated-home-dir
        (setq abbreviated-home-dir
              (let ((abbreviated-home-dir "$foo"))
-               (concat "^" (abbreviate-file-name (expand-file-name "~"))))))
+               (concat "^" (abbreviate-file-name (expand-file-name "~/"))))))
     ;; If FILENAME starts with the abbreviated homedir,
     ;; make it start with `~' instead.
     (if (string-match abbreviated-home-dir filename)